package com.lucnn.diamond.spring;

import com.lucnn.diamond.spring.config.DIConfig;
import com.lucnn.diamond.spring.service.BookService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class MainTest {
    public static void main(String[] args) {
//        ApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml");
////        Person p = ctx.getBean(Person.class);
////        System.out.println(p);

        ApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfig.class);
        BookService p = ctx.getBean(BookService.class);
        System.out.println(p);

        String[] names = ctx.getBeanDefinitionNames();
        for(String name:names){
            System.out.println(name);
        }
    }
}
